Skip to content

Switch the default async Postgres driver from asyncpg to psycopg3 (provider)#69089

Open
Dev-iL wants to merge 1 commit into
apache:mainfrom
Dev-iL:2606/postgres-provider-psycopg3-default
Open

Switch the default async Postgres driver from asyncpg to psycopg3 (provider)#69089
Dev-iL wants to merge 1 commit into
apache:mainfrom
Dev-iL:2606/postgres-provider-psycopg3-default

Conversation

@Dev-iL

@Dev-iL Dev-iL commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

…psycopg3

The async metadata-database driver shipped by the postgres provider now
defaults to psycopg3, which is safe behind transaction-mode PgBouncer with
no extra configuration. asyncpg moves to the opt-in `asyncpg` extra and
remains fully supported via an explicit sql_alchemy_conn_async URL. This
pairs with the matching default change in Airflow 3.4.0.
@Dev-iL Dev-iL force-pushed the 2606/postgres-provider-psycopg3-default branch from 35697d5 to ec31a5a Compare July 2, 2026 08:40
Comment on lines +30 to +42
.. warning::
``asyncpg`` is no longer installed by default — it moved to the ``asyncpg`` optional extra, and
``psycopg`` (psycopg3) is now installed by default as the async metadata-database driver. The
default derived async connection URL changed from ``postgresql+asyncpg://`` to
``postgresql+psycopg_async://``, which is safe behind transaction-mode PgBouncer with no extra
configuration. This aligns with the new default async Postgres driver in Airflow 3.4.0. To keep
using asyncpg, install ``apache-airflow-providers-postgres[asyncpg]`` and set
``[database] sql_alchemy_conn_async = postgresql+asyncpg://...`` explicitly.

On Airflow versions before 3.4.0 the derived async URL always uses asyncpg (there is no psycopg3 fallback in core),
so on those versions this provider release requires either the ``asyncpg`` extra or an explicitly configured
``[database] sql_alchemy_conn_async`` — otherwise the async metadata-database engine fails at startup with
``ModuleNotFoundError: No module named 'asyncpg'``.

@uranusjr uranusjr Jul 2, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also mention the psycopg extra has been removed so you should remove [psycopg].

Also let’s add a 7.0.0 version header. (I think this should be a major version since this is technically a breaking change?)

uranusjr
uranusjr approved these changes Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants